<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>医嘱界面</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/css/to-doctor.css">
<link rel="stylesheet" href="static/easyui/themes/ui-cupertino/easyui.css">
</head>
<body onLoad="show()">
<script type="text/javascript">
//时间转换
function comformatDate(date) {
	var day = new Date(date);
	var Year = 0;
	var Month = 0;
	var Day = 0;
	var CurrentDate = "";
	//初始化时间?
	Year= day.getFullYear();//
	Month= day.getMonth()+1;
	Day = day.getDate();
	Hour = day.getHours();
	Minute = day.getMinutes();
	Second = day.getSeconds();
	CurrentDate += Year + "-";
	if (Month >= 10 ) {
		CurrentDate += Month + "-";
	}else {
		CurrentDate += "0" + Month + "-";
	}
	if (Day >= 10 ) {
		CurrentDate += Day ;
	}else {
		CurrentDate += "0" + Day ;
	}
	if(Hour>=10){
		CurrentDate +=" "+Hour;
	}else{
		CurrentDate +=" "+"0"+Hour;
	}
	if(Minute>=10){
		CurrentDate +=":"+Minute;
	}else{
		CurrentDate +=":"+"0"+Minute;
	}
	if(Second>=10){
		CurrentDate +=":"+Second;
	}else{
		CurrentDate +=":"+"0"+Second;
	}
	return CurrentDate;
};
$(function(){
	//访问数据源、初始化表格 ----药单收费上
	$('#yizhu_px').datagrid({
	    url:'',
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'yizhu_pxA',title:'医嘱编号',width:124,align:'center'},
			{field:'yizhu_pxB',title:'门诊编号',width:124,align:'center'},
			{field:'yizhu_pxC',title:'病人姓名',width:124,align:'center'},
			{field:'yizhu_pxD',title:'医嘱内容',width:262,align:'center'},
			{field:'yizhu_pxE',title:'开嘱医生',width:124,align:'center'},
			{field:'yizhu_pxF',title:'开嘱时间',width:124,align:'center'},
			{field:'yizhu_pxJ',title:'总金额',width:80,align:'center'},
			{field:'yizhu_pxH',title:'状态',width:80,align:'center'},
			{field:'yizhu_pxI',title:'操作',width:80,align:'center'}
	    ]]
	});
});


$(function(){
	//医嘱详情
	$('#yizhuxiangqing_pzh').datagrid({
	    url:'',
	    columns:[[
			{field:'yizhuxiangqing_pzhA',title:'药方详单编号',width:83.3,align:'center'},
			{field:'yizhuxiangqing_pzhB',title:'药品编号',width:83.3,align:'center'},
			{field:'yizhuxiangqing_pzhBB',title:'药品名称',width:83.3,align:'center'},
			{field:'yizhuxiangqing_pzhxD',title:'药品类型',width:83.3},
			{field:'yizhuxiangqing_pzhxDD',title:'药品数量',width:83.3},
			{field:'yizhuxiangqing_pzhE',title:'药品单价',width:83.3},
			{field:'yizhuxiangqing_pzhF',title:'服用天数',width:83.3},
			{field:'yizhuxiangqing_pzhL',title:'每天次数',width:83.3},
			{field:'yizhuxiangqing_pzhxH',title:'每次数量',width:83.3},	
	    ]]
	});
});


$(function(){
	$("#yzxq").click(function(){
		$("#yizhuxq_").window("open");
	});
});

$(function(){
	//访问数据源、初始化表格 ----药单收费上
	$('#yaodanshoufei-table2').datagrid({
	    url:'finDwjfy',
	    fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:10,
	    pageList:[10,6],
	    columns:[[
	    	{field:'prescription_id',hidden:true,title:'药方主表编号',align:'center'},
			{field:'outpatient_id',hidden:true,title:'门诊号',width:130,align:'center'},
			{field:'mecard_number',title:'医疗卡编号',width:130,align:'center'},
			{field:'patient_name',title:'病人姓名',width:110,align:'center'},
			{field:'patient_age',title:'病人年龄',width:110,align:'center'},
			{field:'patient_sex',title:'病人性别',width:140,align:'center'},
			{field:'prescription_name',title:'开方医生',width:140,align:'center'},
			{field:'Prescribing_date',title:'开方时间',width:180,align:'center',formatter:comformatDate},
			{field:'prescription_money',title:'总金额',width:140,align:'center'},
			{field:'yaodanshoufei-tableH',title:'详情',width:140,align:'center',
				formatter:function(value,row,index){
					return "<input type='button' style='background:#E4F1FB;color:#2779AA;border:none' onclick='xmfyxq("+row.prescription_id+")' value='详情'/>"
				}}
			
	    ]]
	});
	
	
});
/*药品详情事件 ====================================*/
function xmfyxq(row){
	 $('#ypsfxq2').datagrid({
	    url:'idFindxq?prescription_id='+row,  
	    columns:[[
	    	{field:'drug_id',title:'药品编号',width:118,align:'center'},
			{field:'drug_name',title:'名称',width:118,align:'center'},
			{field:'drug_selling_price',title:'价格',width:118,align:'center'},
			{field:'drug_types_name',title:'类型',width:118,align:'center'},
			{field:'prescription_details_sl',title:'数量',width:116,align:'center'},
	    ]]
	}); 
	$("#yaopingshoufeixq2").window("open");
};
$(function(){
	//访问数据源、初始化表格-----体检收费上
	$('#tijian_table2').datagrid({
	    url:'djdly',
		pagination:true,
	    pageNumber:1,
	    pageSize:10,
	    pageList:[10,6],
	    columns:[[
	    	/* {field:'tAA',title:'',checkbox:true,}, */
	    	{field:'examine_id',title:'体检号',width:130,align:'center'},
			
			{field:'patient_name',title:'病人姓名',width:120,align:'center'},
			{field:'patient_age',title:'病人年龄',width:140,align:'center'},
			{field:'patient_sex',title:'病人性别',width:120,align:'center'},
			{field:'card_cid',title:'病人身份证号',width:160,align:'center'},
			{field:'examine_time',title:'开设时间',width:180,align:'center',formatter:comformatDate},
			{field:'zongjine',title:'总金额',width:120,align:'center'},
			{field:'tj-tableH',title:'详情',width:100,align:'center',
				formatter:function(value,row,index){
					return "<input type='button' style='background:#E4F1FB;color:#2779AA;border:none' onclick='tjfyxq("+row.examine_id+")' value='详情'/>"
				}}
	    ]]
	});
});

/*体检项目详情事件 ====================================*/
function tjfyxq(row){
	$('#tjxmxq2').datagrid({
	    url:'idtjdl?examine_id='+row,
	    columns:[[
	    	{field:'examine_item_id',title:'项目编号',width:196,align:'center'},
			{field:'examine_item_name',title:'名称',width:196,align:'center'},
			{field:'examine_item_price',title:'价格',width:196,align:'center'},
	    ]]
	
	});
	$("#tijianshoufeixq2").window("open");
};

$(function(){
	//访问数据源、初始化表格-----治疗项目收费上
	$('#xiangmu_table2').datagrid({
	    url:'findCrueCosty',
		pagination:true,
	    pageNumber:1,
	    pageSize:10,
	    pageList:[10,6],
	    columns:[[
	    	{field:'outpatient_id', hidden:true,title:'',width:80,align:'center'},
	    	{field:'mzcard_id', hidden:true,title:'',width:80,align:'center'},
	    	{field:'cure_cost_id', hidden:true,title:'',width:80,align:'center'},//医疗项目费用单改单id
			{field:'mecard_number',title:'医疗卡编号',width:140,align:'center'},
			{field:'patient_name',title:'病人姓名',width:100,align:'center'},
			{field:'patient_age',title:'病人年龄',width:80,align:'center'},
			{field:'patient_sex',title:'病人性别',width:80,align:'center'},
			{field:'card_cid',title:'病人身份证号',width:160,align:'center'},
			{field:'xmys',title:'治疗医生',width:120,align:'center'},
			{field:'project_zje',title:'总金额',width:120,align:'center'},
			{field:'project_date',title:'开方时间',width:180,align:'center',formatter:comformatDate},
			{field:'xiangmu_tableH',title:'详情',width:100,align:'center',
				formatter:function(value,row,index){
					return "<input type='button' style='background:#E4F1FB;color:#2779AA;border:none' onclick='xmxq("+row.cure_cost_id+")' value='详情'/>"
				}}
			
	    ]]
	});
});

/*治疗项目详情事件 ====================================*/		
function xmxq(row){//通过上面的详情的点击事件得到主表记录id作为参数查询详表信息
	$('#zlxmxq2').datagrid({
	    url:'idMzcostDetails?cure_cost_id='+row,  
	    columns:[[
	    	{field:'cure_id',title:'项目编号',width:196,align:'center'},
			{field:'cure_name',title:'名称',width:196,align:'center'},
			{field:'cure_je',title:'价格',width:196,align:'center'},
	    ]]
	});
	$("#zhiliaoxiangmuxq2").window("open");
};

$(function(){
	//根据医疗卡号查询以交费的药单
	$("#bed_ejection1").searchbox({
		searcher:function(value,name){
			$('#yaodanshoufei-table2').datagrid({
			 url:'medfindwjfy?mecard_number='+value
			});
		}
	});
	//根据医疗卡号查询以交费的体检单
	$("#bed_ejection2").searchbox({
		searcher:function(value,name){
			$('#tijian_table2').datagrid({
			    url:'carddjdly?mecard_number='+value
			});
		}
	});
	//根据医疗卡号查询以交费的医疗项目单
	$("#bed_ejection3").searchbox({
		searcher:function(value,name){
			$('#xiangmu_table2').datagrid({
			    url:'medfindCrueCosty?mecard_number='+value
			});
		}
	});
});
</script>
	<div class="easyui-tabs" data-options="region:'west',title:'诊疗',split:true,collapsible:false"style="border:none">
			<div title="处方单管理">
				<fieldset class="yizhu_" style="border:1px solid #19AA8D;border-radius:5px;background:white;width:1105px;padding:15px;">
						<legend>处方管理</legend>
					 <div style="margin-bottom:5px;">
						<input name="Yi_Id2" id="bed_ejection1" class="easyui-searchbox"
						data-options="label:'记录检索：',prompt:'请输入医疗卡号或门诊号',width:350,labelAlign:'right'">
					</div>
						<table id="yaodanshoufei-table2" singleSelect="true" style="height:400px;width:1105px;margin:10px;">
						</table>
				</fieldset>			
			</div>
			<div title="体检单管理">
					<fieldset class="yizhu_" style="border:1px solid #19AA8D;border-radius:5px;background:white;padding:15px;">
						<legend>体检单管理</legend>
					 <div style="margin-bottom:5px;">
						<input name="" id="bed_ejection2" class="easyui-searchbox"
						data-options="label:'记录检索：',prompt:'请输入医疗卡号或体检号',width:350,labelAlign:'right'">
					</div>
					<table id="tijian_table2" singleSelect="true" style="margin-top:10px;height:400px;width:1105px;">		
					</table>
					</fieldset>	
			</div>
			<div title="项目单管理">
					<fieldset class="yizhu_" style="border:1px solid #19AA8D;border-radius:5px;background:white;padding:15px;">
						<legend>项目单管理</legend>
					 <div style="margin-bottom:5px;">
						<input name="" id="bed_ejection3" class="easyui-searchbox"
						data-options="label:'记录检索：',prompt:'请输入医疗卡号或门诊号',width:350,labelAlign:'right'">
					</div>
					<table id="xiangmu_table2" singleSelect="true" style="margin-top:10px;height:400px;width:1105px;">	
					</table>
					</fieldset>
			</div>
	</div>
	<!--药品收费详情 -->
	<div id="yaopingshoufeixq2" class="easyui-window" data-options="modal:true,maximizable:false,closed:true" title="收费药品详情" style="width:604px;">
			<table id="ypsfxq2" class="ypyx" style="width:590px;height:300px;"
			    	data-options=""> 
			</table>
	</div>
	<!--治疗项目收费详情 -->
	<div id="zhiliaoxiangmuxq2" class="easyui-window" data-options="modal:true,maximizable:false,closed:true" title="医疗项目详情" style="width:604px;">
			<table id="zlxmxq2" class="xmyx" style="width:590px;height:300px;"
			    	data-options=""> 			
			</table>
	</div>
	<!--体检项目收费详情 -->
	<div id="tijianshoufeixq2" class="easyui-window" data-options="modal:true,maximizable:false,closed:true" title="体检项目详情" style="width:604px;">
			<table id="tjxmxq2" class="tjyx" style="width:590px;height:300px;"
			    	data-options=""> 				
			</table>
	</div>	
</body>
</html>